#include using namespace std; void main() { //int strlen(const char s[]); //void strcpy(char destination[], const char source[]); //void strcat(char destination[], const char source[]); //int strcmp(const char s1[], const char s2[]); // < 0, 0 , > 0 //int stricmp(const char s1[], const char s2[]); //int strncmp(const char s1[], const char s2[], int n); //int strnicmp(const char s1[], const char s2[], int n); //char* strchr(const char s[], char c); // returns NULL if not found char s[100]; strcpy(s,"This is the day the Lord has made."); cout << s + 5 << endl; cout << (int) s << endl; char c = ' '; //cin >> c; char* p = strchr(s, c); if(p != NULL) { int index = (int)(p-s); cout << c << " was found at index " << index << endl; } else { cout << c << " was not found"; } p = strchr(s, c); int previousIndex = 0; while(p != NULL) { int index = (int)(p-s); char word[100]; strncpy(word,s+previousIndex, index-previousIndex); cout << word << endl; cout << index << endl; p = strchr(s + index + 1, c); previousIndex = index; } //strcpy("bob",s); //this is bad it will crash //if(strcmp(s1,s2)==0) //{ //} }